<template>
	<view class="myTeam" :class='equipment' v-if="res">
		<view class="myTeam_yue">
			<view class="myTeam_yue_title">
				ID：{{res.member_info.id}}
				<view class="jibiei">
					V{{res.member_info.new_level}}
				</view>
			</view>
			<view class="myTeam_newItem">
				{{res.member_info.createtime}}
			</view>
		</view>
		<view class="myTeam_box">
			<view class="myTeam_box_title">
				<view class="myTeam_box_title_item" style="text-align: left;">
					团队ID
				</view>
				<view class="myTeam_box_title_item" style="text-align: center;">
					团队业绩
				</view>
				<view class="myTeam_box_title_item" style="text-align: right;">
					团队时间
				</view>
			</view>
			<view class="myTeam_box_list">
				<view class="myTeam_box_list_item" v-for="(item,index) in res.xiaji" :key="index">
					<view class="myTeam_box_list_items" style="text-align: left;">
						{{item.id}}
					</view>
					<view class="myTeam_box_list_items" style="text-align: center;">
						{{item.new_yj}}
					</view>
					<view class="myTeam_box_list_items" style="text-align: right;">
						{{item.createtime}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		api_index_get_my_team
	} from '@/api/member.js'
	export default {
		data() {
			return {
				openid: '',
				title: '',
				res: '',
				equipment: ''
			};
		},
		onLoad() {
			if (process.env.UNI_PLATFORM === 'h5') {
				// 在H5环境中打开
				console.log('在H5环境中打开');
				this.equipment = 'H5'
			} else if (process.env.UNI_PLATFORM === 'app-plus') {
				// 在App环境中打开
				console.log('在App环境中打开');
				this.equipment = 'App'
			}
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data;
					this.api_index_get_my_teamFun();
				},
				fail: () => {
					uni.reLaunch({
						url: '/pages/login/login'
					});
				}
			});
		},
		methods: {
			async api_index_get_my_teamFun() {
				let data = await api_index_get_my_team(this.openid)
				this.res = data;
			}
		}
	}
</script>

<style lang="scss">
	.H5 {
		height: calc(100vh - 88rpx);
	}

	.App {
		height: 100vh;
	}

	.myTeam {
		width: 100%;
		padding: 20rpx 40rpx;
		display: flex;
		flex-direction: column;


		.myTeam_yue {
			width: 100%;
			height: 160rpx;
			background-image: url('@/static/login/login_back.png');
			background-repeat: no-repeat;
			background-size: 100%;
			padding: 20rpx 40rpx;
			color: #fff;
			margin: 10rpx 0;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.myTeam_newItem {
				font-size: 26rpx;
				color: #f4f4f4;
			}

			.myTeam_yue_title {
				color: #fff;
				font-size: 34rpx;
				line-height: 40rpx;
				display: flex;
				align-items: center;


				.jibiei {
					height: 60rpx;
					width: 60rpx;
					background-image: url('@/static/member/jp.png');
					background-repeat: no-repeat;
					background-size: 100%;
					font-size: 16rpx;
					line-height: 56rpx;
					text-align: center;
					color: #333;

				}
			}
		}


		.myTeam_box {
			width: 100%;
			flex: 1;
			display: flex;
			flex-direction: column;
			padding: 0 10rpx;


			.myTeam_box_title {
				width: 100%;
				height: 80rpx;
				line-height: 80rpx;
				display: flex;

				.myTeam_box_title_item {
					flex: 1;
					text-align: center;
				}
			}

			.myTeam_box_list {
				width: 100%;
				flex: 1;
				overflow-y: auto;

				.myTeam_box_list_item {
					width: 100%;
					display: flex;
					justify-content: space-between;

					.myTeam_box_list_items {
						line-height: 60rpx;
						border-top: #f4f4f4 solid 1rpx;
						flex: 1;
						font-size: 26rpx;
					}
				}
			}
		}
	}
</style>